//
//  LaunchCrowdfundingViewController.m
//  ioschishan
//
//  Created by 马田成 on 2017/7/14.
//  Copyright © 2017年 qianyi. All rights reserved.
//

#import "LaunchCrowdfundingViewController.h"
#import "startTableViewCell.h"
#import "startMoneyViewController.h"

@interface LaunchCrowdfundingViewController ()<UITableViewDelegate , UITableViewDataSource>{
    
    NSArray *titleArray;
    NSArray *imgArray;
    NSArray *messageArray;
}

@property(nonatomic,strong) NSMutableArray *dataArray;
@property(nonatomic,strong) NSMutableDictionary *dataDic;
@property(nonatomic,strong) UITableView *helpTableView;

@end

@implementation LaunchCrowdfundingViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self initView];
}

#pragma mark ------------------ init -------------------

- (void)initView{
    
    self.title = @"发起众筹";
    
    titleArray = @[@"老师",@"学校",@"孩子"];
    imgArray = @[@"fund_teacher_icon",@"fund_school_icon",@"fund_kids_icon"];
    messageArray = @[@"点滴温暖，让老师更好的传道解惑",@"贡献力量，筑建更好的教学环境",@"伸出双手，扶贫助学"];
    
    _helpTableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, scrWidth(), scrHeight() - 64)];
    _helpTableView.backgroundColor = getColor(@"ffffff");
    _helpTableView.delegate = self;
    _helpTableView.dataSource = self;
    _helpTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    [self.view addSubview:_helpTableView];
    
    UIView *threadView = [[UIView alloc]initWithFrame:CGRectMake(0, screenScale(1), scrWidth(), screenScale(0.7))];
    threadView.backgroundColor = getColor(@"cccccc");
    [self.view addSubview:threadView];
}

#pragma mark -------------------- tableView ----------------------

#pragma mark --- UITableViewDelegate ---

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return screenScale(65);
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    startMoneyViewController *vc = [[startMoneyViewController alloc]init];
    vc.classify = [NSString stringWithFormat:@"%d",indexPath.row + 1];
    [self.navigationController pushViewController:vc animated:YES];
}

#pragma mark --- UITableViewDataSource ---

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return 3;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    [tableView registerClass:[startTableViewCell class] forCellReuseIdentifier:@"identifier"];
    startTableViewCell *cell = (startTableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"identifier" forIndexPath:indexPath];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    cell.leftImg.image = [UIImage imageNamed:imgArray[indexPath.row]];
    cell.nameLable.text = titleArray[indexPath.row];
    cell.statusLable.text = messageArray[indexPath.row];
    
    return cell;
}

@end
